System and method of caching information

ABSTRACT

A system and method is provided wherein, in one aspect, a currently-requested item of information is stored in a cache based on whether it has been previously requested and, if so, the time of the previous request. If the item has not been previously requested, it may not be stored in the cache. If the subject item has been previously requested, it may or may not be cached based on a comparison of durations, namely (1) the duration of time between the current request and the previous request for the subject item and (2) for each other item in the cache, the duration of time between the current request and the previous request for the other item. If the duration associated with the subject item is less than the duration of another item in the cache, the subject item may be stored in the cache.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a continuation of United States application No. Thisapplication is a continuation of U.S. application Ser. No. 12/545,225,filed on Aug. 21, 2009, the disclosure of which is incorporated hereinby reference.

BACKGROUND OF THE INVENTION

A cache is commonly provided in a system having a processor to storeitems of information for access by the processor at a lower “cost” thanif the cache were not present. For example, a system may be structuredsuch that the processor can obtain data or program instructions storedin one memory faster than other memories. This memory may be used as acache so that frequently-accessed information contained in the othermemories may be copied into and accessed from the cache instead. Inaddition, the use of a cache may help to reduce internal data trafficbetween the processor and internal system elements such as a memory orinput-output interface when the information items are available locally,as well as reduce external data traffic between the system and a remotesystem when the information is not available locally.

Caches are often too small to store all of the information a processormay need. Accordingly, cache-based systems typically need to beselective when it comes to determining which information will be storedin the cache. For example, a processor may repeatedly and frequentlyaccess ten different items of information, but the cache may only beable to store five.

Various algorithms have been used to determine when an item should bestored in the cache. For example, some existing systems automaticallystore the most-recently used information in the cache. If the processorrecently processed ten items and the cache can store five, the last fivediscrete items are stored in the cache regardless of how often the itemsare used.

SUMMARY OF THE INVENTION

In one aspect, a method is provided that includes: receiving a requestto process an item of information at a processor with an associatedcache; retrieving the requested item from the cache when the item isstored therein; retrieving the requested item from another memory whenthe item is not stored in the cache; processing the item without storingthe item in the cache when the item has not been previously requestedwithin a predetermined period; processing the item without storing theitem in the cache when the item has been previously requested within apredetermined period and the time of the previous request is earlierthan the latest request for each item within a set of items stored inthe cache; and processing the item and storing the item in the cachewhen the item has been previously requested within the predeterminedperiod and the time of the previous request is later than the latestrequest of at least one item within the set of items stored in thecache.

In another aspect, a method is provided that comprises: receiving acurrent request for a first item of electronically-stored information,the first item being stored in a first memory; providing the first itemfrom a second memory when the first item is also stored therein;providing the first item from the first memory when the first item isnot stored in the second memory; determining, with a processor, whetherthe first item has been previously requested within a predeterminedperiod of time; determining, with a processor, a first durationassociated with the first item when the first item has been determinedto have been previously requested, where the first duration is theduration of time between the current request for the first item and theprevious request for the first item; determining, with a processor, asecond duration for each item of a set of previously-requested seconditems stored in the second memory, where the second value is theduration of time between the current request for the first item and thelatest request for the second item; and storing the first item in thesecond memory when the first item has been previously requested and thefirst duration is less than at least one of the second durations.

Still another method relates to: receiving a request for a first item ofelectronically-stored information; providing the first item from a firstmemory without storing the first item in a second memory when the firstitem has not been previously requested within a predetermined period oftime; providing the first item from the second memory when the firstitem is stored therein, the second memory also storing a plurality ofother items each of which has been previously requested at least twice;providing the first item from the first memory without storing the firstitem in second memory when the first item has not been previouslyrequested within a predetermined period of time; determining, with aprocessor, a first value associated with the first item when the firstitem has been determined to have been previously requested, where thefirst value is based on the duration of time between previous requestsfor the first item; determining, with a processor, a second valueassociated with each item of a set of previously-requested second itemsstored in the second memory, where the second value is based on theduration of time between the current request for the first item and thelatest request for the second item and; providing the first item fromthe first memory and storing the first item in the second memory whenthe first item has been previously requested within a predeterminedperiod of time, and based on a comparison of the first value with thesecond value.

A further aspect provides a system that includes a cache configured tostore items of information, other memory configured to store items ofinformation, and a processor configured to retrieve and store items inthe cache in accordance with instructions and provide the items to arequesting device. The instructions include, in response to a requestfor a requested item from the requesting device: retrieving therequested item from the cache when the requested item is stored therein;retrieving the requested item from the other memory when the requesteditem is not stored in the cache; providing the requested item to therequesting device, without storing the requested item in the cache priorto the next request, when the item has not been previously requestedwithin a predetermined period; providing the requested item to therequesting device, without storing the requested item in the cache priorto the next request, when the item has been previously requested withina predetermined period and the time of the previous request is earlierthan the latest request for each item within a set of items stored inthe cache; and providing the requested item to the requesting device,and storing the requested item in the cache prior to the next request,when the item has been previously requested within the predeterminedperiod and the time of the previous request is later than the latestrequest of at least one item within the set of items stored in thecache.

Another system may include a processor configured to retrieve and storeitems in memory in accordance with instructions. It may also include afirst memory having a first capacity and a first access time (whereaccess time refers to the average time it takes for the processor toobtain information from a memory), a second memory having a highercapacity and slower access time than the first memory and a third memoryhaving a higher capacity and slower access time than the second memory.The instructions may include, in response to a request for a request forthe item received by the processor: retrieving the requested item fromfirst memory when the requested item is stored in the first memory;retrieving the requested item from second memory when the requested itemis stored in the second memory; retrieving the requested item from thirdmemory when the requested item is stored in the third memory; storingthe requested item in the first memory depending on whether the item wasstored in the second memory at the time of the request and whether thetime elapsed since the last time the item was requested is less than thelast-eviction duration, where the last-eviction duration comprises theduration of time beginning with the last request for the most-recentlyevicted item while it was still stored in the first memory and endingwith the most-recently evicted item's eviction from the first memory;storing the requested item in the second memory depending on whether theitem was stored in the second memory at the time of the request andwhether the item was retrieved from the third memory.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a functional diagram of a system of servers and client devicesin accordance with an aspect of the invention.

FIG. 2 is a functional diagram of a computer chip and instruction storein accordance with an aspect of the invention.

FIG. 3 is a functional diagram of a multi-tiered system of servers andclient devices in accordance with an aspect of the invention.

FIG. 4 is a functional diagram of computer in accordance with an aspectof the invention.

FIG. 5 is a flowchart in accordance with an aspect of the invention.

FIG. 6 is a flowchart in accordance with an aspect of the invention.

DETAILED DESCRIPTION

In accordance with one aspect of the invention, a currently-requesteditem of information is stored in the cache based on whether it has beenpreviously requested and, if so, the time of the previous request.Specifically, if the item has never been previously requested, the itemis not stored in the cache (where “never” may refer to a predeterminedperiod of time, such as “never within the 24 hours” or never within aperiod of time that is dynamically determined based on data that changesover time). If the subject item has been previously requested, thesubject item is cached based on a determination and comparison ofdurations, namely (1) the duration of time between the current requestand the previous request for the subject item and (2) for each otheritem in the cache, the duration of time between the current request andthe previous request for the other item. If the duration associated withthe subject item is less than the duration of another item in the cache,the subject item will be stored in the cache.

As shown in FIG. 1, a system 100 in accordance with one aspect of theinvention includes a computer 110 containing a processor 120, memory130, clock 115 and other components typically present in general purposecomputers. Memory 130 stores information accessible by processor 120,including instructions 131 that may be executed by the processor 120. Italso includes data 135 that may be retrieved, manipulated or stored bythe processor. The memory may be of any type capable of storinginformation accessible by the processor, including a computer-readablemedium such as a hard-drive, memory card, ROM, RAM, DVD or other opticaldisks, as well as other write-capable and read-only memories. Theprocessor 120 may be any well-known processor, such as processors fromIntel Corporation or AMD. Alternatively, the processor may be adedicated controller such as an ASIC.

The instructions 131 may be any set of instructions to be executeddirectly (such as machine code) or indirectly (such as scripts) by theprocessor. For example, the instructions may be stored as computer codeon the computer-readable medium. In that regard, the terms“instructions” and “programs” may be used interchangeably herein. Theinstructions may be stored in object code format for direct processingby the processor, or in any other computer language including scripts orcollections of independent source code modules that are interpreted ondemand or compiled in advance. Functions, methods and routines of theinstructions are explained in more detail below.

Data 135 may be retrieved, stored or modified by processor 120 inaccordance with the instructions 131. For instance, although the systemand method is not limited by any particular data structure, the data maybe stored in computer registers, in a relational database as a tablehaving a plurality of different fields and records, XML documents orflat files. The data may also be formatted in any computer-readableformat such as, but not limited to, binary values, ASCII or Unicode.Image data may be stored as bitmaps comprised of pixels that are storedin accordance with formats that are compressed or uncompressed, lossless(e.g., BMP) or lossy (e.g., JPEG), and bitmap or vector-based (e.g.,SVG), as well as computer instructions for drawing graphics. Video datamay be stored in a variety of formats including MPEG, GIF, AVI, M-JPEG,Flash, QuickTime and others. The data may comprise any informationsufficient to identify the relevant information, such as numbers,descriptive text, proprietary codes, pointers, references to data storedin other memories (including other network locations) or informationthat is used by a function to calculate the relevant data.

Although FIG. 1 functionally illustrates the processor and memory asbeing within the same block, it will be understood by those of ordinaryskill in the art that the processor and memory may actually comprisemultiple processors and memories that may or may not be stored withinthe same physical housing. For example, some of the instructions anddata may be stored on removable CD-ROM and others within a read-onlycomputer chip. Some or all of the instructions and data may be stored ina location physically remote from, yet still accessible by, theprocessor. Accordingly, references to a computer, processor and memorywill be understood to include references to a collection of computers,processors or computers that may or may not operate in parallel.

Computer 110 may be located at one or more nodes of a network 195 andcapable of directly and indirectly communicating with other nodes of thenetwork. For example, computer 110 may comprise a web server that iscapable of communicating with client devices 150-52 via network 195,delivering web pages to the client devices 150-52 and receivinginformation and requests in response. Server 110 may use network 195 totransmit and display information to a user on monitor 160 of clientdevice 150.

Network 195, and intervening nodes between server 110 and clientdevices, may comprise various configurations and use various protocolsincluding the Internet, World Wide Web, intranets, virtual privatenetworks, wide area networks, local networks, private networks usingcommunication protocols proprietary to one or more companies, cellularand other wireless networks, Internet relay chat channels (IRC), instantmessaging, simple mail transfer protocols (SMTP), Ethernet, WiFi andHTTP, and various combinations of the foregoing. Although only a fewcomputers are depicted in FIG. 1, it will be appreciated that a typicalsystem can include a large number of connected computers.

Each client device may be configured similarly to the server 110, with aprocessor, memory and instructions. Each client device 150-52 may be apersonal computer, intended for use by a person 190-191, having all theinternal components normally found in a personal computer such as acentral processing unit (CPU), display device 160 (for example, amonitor having a screen, a projector, a touch-screen, a small LCDscreen, a television, or another device such as an electrical devicethat is operable to display information processed by a processor), DVDdrive, hard-drive, user input device 163 (for example, a mouse,keyboard, touch-screen or microphone), speakers, modem or networkinterface device (telephone, cable, wireless or otherwise), and all ofthe components used for connecting these elements to one another.

Although the client devices 150-52 may comprise a full-sized personalcomputer, the system and method may also be used in connection withmobile devices capable of wirelessly exchanging data with a server overa network such as the Internet. For example, a client device may be awireless-enabled PDA such as a Blackberry phone or an Internet-capablecellular phone. The user may input information using a small keyboard(in the case of a Blackberry phone), a keypad (in the case of a typicalcell phone), a touch screen (in the case of a PDA) or any other userinput device. Indeed, computers in accordance with the systems andmethods described herein may comprise any device capable of processinginstructions and transmitting data to and from humans and othercomputers including general purpose computers, network computers lackinglocal storage capability, and set-top boxes for televisions.

In addition to server 110, system 100 may include other servers as well.For example, servers 115-16 may store information to be delivered toother nodes of the network such as audio/visual video files offered viaGoogle's YouTube service. Other non-limiting examples of contentincludes music, still images, programs including computer games andcombinations of the foregoing. The visual content may be rendered to auser via the electronic display 160 of the client device and the audiocontent may be rendered via speakers associated with the client device.The content may be provided for free or fee-based, and may be restrictedor subject to digital rights management (DRM).

Server 110 may communicate with content servers 115-16 via a network196. The network may be configured similarly to network 195. Indeed, inat least one aspect, networks 195 and 196 share the same nodes; forexample, both networks 195 and 196 may comprises the Internet.

Server 110 may include a cache 140 that stores information that may berequired by the server for future use. For example, the cache may storecontent files originally received from servers 115-16 and provided tothe client devices 150-52. As explained in more detail below, this isjust one possible aspect of a system and method in accordance with theinvention.

In one aspect and in many circumstances, the server 110 is typicallyable to deliver information from cache 140 to client devices 150-52faster than obtaining the information from content servers 115-16. Forexample, server 110 may be geographically closer to the client devicesthan the content servers. Server 100 may also be topologically closer tothe client devices, e.g., if the Internet is serving as both network 195and network 196, there may be more intervening nodes between contentserver 115 and client device 150 than between server 110 and clientdevice 150. Yet further, the cache 140 may be stored in the same housingas processor 120, such as a large hard drive physically located within aserver; such configurations typically provide the processor with veryfast access to the information. However, the cache 140 may also be inanother location that results in more latency than a hard drive but lesslatency than obtaining the information from content servers 115-16.

The system and method may store, retrieve and process information invarious formats, configurations and sizes. In that regard, the items ofinformation stored in the cache can be of different sizes or can havethe same size. In some aspects, each item is a single file thatrepresents all of the information desired by a user (e.g., the file is amusic video of an entire song). In other aspects, each item is afixed-size packet of information that cannot be meaningfully used by auser until the user's client device receives and assembles multiplepackets together. Combinations of the foregoing are also possible, e.g.,each individual item in the cache may be fixed-sized portion of a musicvideo, and the server 110 streams a music video to the user's clientdevice by retrieving and transmitting individual packets from the cache.

The system and method may also process data indicative of the length oftime between requests for items. For example, data 135 may store requestrecords 145 where each record identifies a content file 143 stored incache 140 and the date and time that the file was last requested by aclient device. In one aspect, the request records 145 may be stored as ahash table where the key is the file's identifier (e.g., a unique numberassigned to each different video file) and the key points to the dateand time that a client device last requested the file.

The request records may also identify whether the item is stored in thecache, because not all requested items may be cached andpreviously-requested items may be cached and then evicted from thecache.

Some aspects may store additional information as well, as noted below.

In addition to the operations illustrated in FIG. 5, various operationsin accordance with a variety of aspects of the invention will now bedescribed. It should be understood that the following operations do nothave to be performed in the precise order described below. Rather,various steps can be handled in reverse order or simultaneously.

In one aspect, the system and method includes a server that uses thecache to store information that may be requested by the client devices.For example, server 110 may be one of many servers edge serverassociated with a website such as www.youtube.com. In that regard, auser may use client device 150 to interact with a web server thatoperates a video file search engine. The engine server may provide theuser with a list of matching videos, and allow the user to then selectand go to a webpage that is specific to the desired video. Although itwas served by the engine server, this video-specific webpage may containa URL that points directly at server 110 and the file's unique ID.Accordingly, when the user requests a copy of the video, such as byclicking a “play” button, the request is sent directly to server 110rather than the engine server.

Upon receiving the request for the information, the system and methodmay cause the requested information to be retrieved and provided to therequesting entity. For example, server 110 may first determine whethercache 140 contains a copy of a requested content file. If the file iscontained in the cache, the processor 120 may transmit a copy of thefile from the cache 145 to client device 150 via network 195. If thefile is not contained in the cache, the processor may request the filefrom one of the content servers 115-16 and forward it to the clientdevice 150, such as by proxying. Alternatively, the server 110 mayprovide the content server or the client device with sufficientinformation so that the client device can obtain the file from thecontent server without passing the file through server 110, such as byproviding a reference to the location via an HTTP 302 redirect.

When the processor receives a request for the information, it determineswhether the information has been previously requested. For example, theserver 110 may query request records 145 and determine whether thecontent file has been previously requested from any of the clientdevices 150-52. If the records are stored in a hash table, processor 120may check the hash table for a record having a key that matches thefile's UID. If such a key is missing, processor 120 determines that thefile has not been previously requested. If the key is present, processor120 determines that the file has been previously requested.

If the requested item has not been previously requested, the system andmethod does not cache the information but does store data related to thetime of the request. For example, it may add a key/value pair to thehash table 145 that identifies the UID of the requested file and thedate and time of the request. It may also include a value in the record,such as a flag, indicating that the file is not currently stored in thecache.

If the desired information has been previously requested, the processordetermines the last time it was previously requested and compares itwith information identifying the request times of other information inthe cache. The decision to cache or not may be based on thatdetermination.

In one aspect of the system and method, an item is cached if, excludingthe time of the current request, it was more recently requested thananother item in the cache. For example, assume that server 110 receivesa request for “File #3” at 7:00 pm and the request records 145 identifythe following information:

Date and time the item Item currently UID was last requested stored incache? 1 1:00 pm Yes 2 2:00 pm NO 3 3:00 pm NO 4 4:00 pm Yes 5 5:00 pmNO 6 6:00 pm Yes

-   -   1. Based on the foregoing, File #3 was requested more recently        (3:00 pm) than File #1 (1:00 pm)—excluding the time of the        current request. Accordingly, File #3 would be stored to the        cache.    -   2. If the cache lacks the capacity to store the        currently-requested item, the system and method may remove the        item that has sat in the cache the longest since its last        request. Using the foregoing example, it has been six hours        (7:00 pm minus 1:00 pm) since File #1 was previously requested.        Therefore, no matter when the next request comes in for File #1,        the duration between the last request and the next request        cannot be any less than six hours. This duration is longer than        any another duration for any other file. Accordingly, if there        is not enough room for both File #1 and File #3, File #1 may be        removed from the cache 140, File #3 may be added to the cache,        and the request records 145 may updated as follows (changes from        the last chart are shown in bold).

Date and time when the Item currently UID item was last requested storedin cache? 1 1:00 pm NO 2 2:00 pm NO 3 7:00 pm Yes 4 4:00 pm Yes 5 5:00pm NO 6 6:00 pm YesIf there is still insufficient room to store the currently-requesteditem after another item is removed, the system and method may continueto evict items until enough room is provided.

In one aspect, the system and method uses the data associated with themost-recently evicted item to determine whether the currently-requesteditem should be cached. For example, when File #1 is removed, server 110may store a pointer in data 135 to the request record for File #1, asindicated by the “-X->” below.

Date and time when the Item currently UID item was last requested storedin cache? −X −> 1 1:00 pm NO 2 2:00 pm NO 3 7:00 pm Yes 4 4:00 pm Yes 55:00 pm NO 6 6:00 pm YesAssume that server 110 next receives a request for File #5 at 8:00 pm.Rather than comparing the last time that the currently-requested itemwas requested with every item in the cache, the processor may compare itwith the most recently removed item. In that regard, having determinedthat File #5 was previously requested (5:00 pm) more recently than thefile that was just evicted (File #1 at 1:00 pm), File #5 may be added tothe cache. If File #4 had to be removed to make room for File #5, theresulting request records 145 may appear as follows.

Date and time when the Item currently UID item was last requested storedin cache? 1 1:00 pm NO 2 2:00 pm NO 3 7:00 pm Yes −X−> 4 4:00 pm NO 58:00 pm Yes 6 6:00 pm Yes

In another aspect, the system and method may compare the current itemagainst the amount of time that the last-evicted item survived in thecache since its last request. Returning to the foregoing example, whenthe system and method had to pick an item to evict at 7:00 pm, itevicted File #1 because no other item had sat in the cache longerwithout a request. Thus, if one defines the “worst performer” as themost-recently evicted item, and if one defines its “wasted time” as thelength of time it sat in the cache unrequested prior to its conviction,File #1 was the worst performer and it wasted six hours (7:00 evictionminus 1:00 last request).

In that regard, if the new item is expected to “waste” more time thanthe “worst performer,” one aspect of the system and method may determinethat the new item should not cached at all. In that regard and thisaspect, File #5 will be cached when it is requested because the spanbetween its last request (5:00 pm) and its current request (8:00 pm) isthree hours, which is less time than that wasted by the worst performer(six hours). However, assume that File #11 is requested at the same timeas File #5 (8:00 pm), but File #11 was previously requested nine hoursago (at 11:00 am). If File #11 was placed in the cache and it wentanother nine hours without a request, this would mean it wasted moretime in the cache than the current worst performer: File #1 at sixhours. Accordingly, the system and method may determine that File #11should not be cached at all.

If the last time the currently-requested item was requested is earlierthan other items in the cache, the processor may decide not to cache theitem. Even so, it may still update the request records to reflect thetime of the current request. For example, assume that the requestrecords appear as follows when a request for File #1 is received at 9:00pm.

Date and time when the Item currently UID item was last requested storedin cache? 1 1:00 pm NO 2 2:00 pm NO 3 7:00 pm Yes −X−> 4 4:00 pm NO 58:00 pm Yes 6 6:00 pm YesThe system and method may compare the prior request for thecurrently-requested item (File #1 at 1:00 pm) with the latest requestfor the most recently evicted item (File #4 at 4:00). Even though File#4 was just evicted for remaining in the cache too long without arequest, it was more recently requested than File #1 (putting aside thefact that the system is evaluating the current request for File #1).Thus, File #1 will not be placed in the cache, but its records will beupdated as follows.

Date and time when the Item currently UID item was last requested storedin cache? 1 9:00 pm NO 2 2:00 pm NO 3 7:00 pm Yes −X−> 4 4:00 pm NO 58:00 pm Yes 6 6:00 pm YesIn that regard, if File #1 is requested again an hour later at 10:00 pm,it will be added to the cache because it was requested more recently(9:00 pm) than the item that was just evicted (File #4 at 4:00 pm).

As noted above, one aspect of the system and method uses the time of thecurrent request and the time of the last request (among other things) todetermine whether an item should be cached.

In another aspect, the system and method uses the time of the currentrequest, the time of the last request and the time of earlier requestsas well to make the determination. Moreover, the system and method mayapply different weights when making the determination. For instance,when determining whether an item should be cached, that time of thelatest requests may be considered more important than the time of theearlier requests.

One such system and method uses exponential decay. By way of exampleonly, each item may be assigned a priority value such that a lowerpriority item will be removed from the cache, if necessary, to make roomfor a higher priority item. Just one possible method comprises assigningeach item a priority value of “E” where:

E _(n)=−1(ALPHA*LS _(n)+(1−ALPHA)*E _(n-1));

-   -   “n” represents the n^(th) occurrence of the request, e.g., E₁₀        represents the priority value of the item after it was requested        10 times;    -   “LS_(n)” represents the amount of time that elapsed between the        n^(th) occurrence of the request and the previous request, e.g.,        LS₁₀ represents the amount of time that elapsed between the        ninth and tenth request for the item; and    -   “ALPHA” represents a value between and including 0 and 1.        In that regard, the processor may calculate a priority value for        an item each time it is requested. If the value indicates that        the item is higher in priority than other items in the cache,        the item is cached. If there is not enough room for the item in        the cache, lower priority items may be removed. (It will be        understood that the −1 multiplier in the foregoing formula may        be omitted, in which case higher E_(n) values may be considered        less desirable for caching than lower E_(n) value.)

As noted above, the priority value may be calculated such that recentrequests are accorded more weight than older requests. In that regard,if the foregoing formula for E_(n) is used, ALPHA may be selected toprovide more or less weight to the most recent request. For example, ifALPHA is selected to be 0.9, 90% of the priority value will depend onthe duration of time between the current request and the last request.However, if ALPHA is selected to be 0.2, only 20% of the priority valuewill depend on the duration of time between the current request and thelast request; the remainder of the value will depend on durationsbetween prior requests. In that regard, ALPHA may be selected based onthe needs of the system. ALPHA may also be automatically and dynamicallyadjusted over time based on periodic statistical analyses of the system.

The impact of a prior request on an item's cache priority mayexponentially diminish as more subsequent requests are received. Forexample, assume there are 10 requests for the item. Even if the ALPHAvalue of E_(n) is set to 0.2 (making only 20% of the priority valuedependant on the duration between the two most recent requests), theduration of time between the 1st and 2nd requests will affect thepriority value far less than the duration of time between the 9th and10th requests. Indeed, if ALPHA is 0.2 and there are approximately 10requests, the impact of the latest duration relative to the earliestdurations may be approximately 10:1. On the other hand, ALPHA may be setto 1, in which case the priority value depends entirely on the durationbetween the latest requests.

If a request for an item is received for the first time and theforegoing formula for E_(n) is used, a default value for E_(zero) may beselected. Because lower E values typically indicate higher priorityitems, a low default value for E_(zero) may be selected if it ispreferable to give never-seen-before items a high priority, and viceversa.

Alternatively, the request records 145 may store a single value of “E”for each item, i.e., it does not store a separate E value for eachrequest of each item. In that regard, when an item is requested for thefirst time, a special value for E may be stored to indicate that theitem's last request was also its first request. When the next requestfor the item is received, the system and method may check whether thecurrent E value equals the special value. If so, the value of E may becalculated as if ALPHA=1, which places all of the weight in the formulato the span of time between the first and second request. If the systemand method determines that the value of current value of E is not thespecial value, the formula may be calculated in accordance with theusual value of ALPHA. Regardless, the system and method may then replacethe prior value of E with the newly-calculated value for E.

One of the advantages of the system and method is its flexibility, suchas its ability is to be implemented in configurations that are differentfrom the foregoing aspects or that can be synergistically combined withthe foregoing aspects.

For example, the foregoing system and method may be combined with othersystems and methods for determining whether an item of informationshould be cached. In that regard, there may be circumstances in whichthe item is cached in spite of the fact that it has never beenpreviously requested. The processor may automatically store an item inthe cache whenever there is room, i.e., the size of the item is lessthan the total capacity of the cache minus the combined sizes of the allof the other items (if any) stored in the cache. Alternatively, theremay be other characteristics associated with an item that may indicatewhether it should be cached. For example, the processor may be providedwith information indicating that the file is very popular and the E_(n)formula described above may include the popularity of the file as aweighted factor.

The system and method may also base a caching decision on the time ofthe request without storing the precise date and time of requests. Asnoted above in connection with priority values, the system and methodmay store a value that is calculated from a formula having manyparameters, only one of which is the request time.

As also noted above, the system and method is not limited to anyparticular size of item. By way of example only, individual items maycomprise variable-sized files, fixed-sized portions of data or both. Onemay consider the example of a variable-sized video file that is storedand streamed in fixed-size chunks, such as 8.5 MB file comprising fourchunks of 2 MB each and one chunk of 0.5 MB. It is common for users toterminate a video after watching the beginning, so it is quite possiblethat the server will only send the first chunk or two. In one aspect,the system and method may consider each chunk to be a separate item, inwhich case the first two chunks might be cached but the remainder mightnot.

In another aspect, the system and method may consider the entire file tobe a single item, in which case all of the chunks are cached in responseto repeated requests for the file even if only the first one or twochunks are consistently delivered to end users. This aspect may beparticularly useful when server 110 serves a file from another server byproxy in accordance with HTTP protocol; it may not be possible forserver 110 to stream the first two chunks of a requested file from itscache and the remainder through a redirect to another server.

In still another aspect, the system and method may cache an entire itemin accordance with the system and method yet evict portions of item inaccordance with different criteria. For example, the server may cacheall four chunks of the 8.5 MB file based on the request records for thefile. However, the server may also use a well-known caching algorithm(e.g., a Least Recently Used (LRU) algorithm) to occasionally evictunpopular chunks, such as the last two chunks of the 8.5 MB file if theyare rarely sent to users. As noted above, the system and method maydetermine whether to cache a newly-requested item by comparing therequest times of the newly-requested file with the most-recently evicteditem's span of survival. In the aspect described in this paragraph, thesystem and method may compare a newly-requested file's request timeswith the survival times of the most-recently evicted chunk.

Moreover, while particular advantages may flow when the system andmethod is used in connection with large client/server content-deliverynetworks, certain aspects may also be implemented in an enclosed systemas small as a computer chip. By way of example only and as shown in FIG.2, a microprocessor 210 may pre-fetch sequences of microcodeinstructions from an instruction source 220 and store them in arelatively small cache 230 on a single semiconductor chip 240 if thesystem expects that the instructions will be used in the near future. Inthat regard, an individual item of information may constitute a sequenceof microcode instructions that are retrieved and processed by themicroprocessor. When the microprocessor 210 needs and instruction, itmay request it from cache control 250. If the instruction is part of abranch of instructions and the instruction's branch is stored in cache230, control 250 provides the instruction from the cache. Otherwise,control 250 obtains the applicable branch from instruction store 220. Ifthe branch has been retrieved from store 220 for the first time, it willnot be cached. However, if the branch has been previously retrieved,control 250 may decide to cache the branch based on the last time thebranch was processed relative to the other branches stored in the cache.

Conversely, the system and method may be implemented in even largernetwork based systems than those described above. For example and asshown in FIG. 3, edge server 310 may request data from second tierservers 315-16, which may have their own caches 325-26 and sets ofrequest records 335-36 and contain only a portion of files that areavailable from other servers operated by the company operating theservers illustrated in FIG. 3. In many circumstances, the second tier ofservers will have greater storage capacity, such as a larger cache size,than the edge server. Second tier servers 315-16 may thus request filesfrom other servers such as third tier servers 340-41, which in turn maystore (or otherwise be capable of obtaining) all of the informationavailable via server 310. A request for a file from any of the clientdevices 150-53 may thus cause requests for the file and its caching tocascade throughout multiple tiers of the entire system 300. In thatregard, the system and method may be used to determine which files areto be cached at the edge server 310 and which should be redirected tolarge caches with larger capacity.

The system and method may be particularly advantageous when used inconnection with regionally-distributed edge servers. For example, if thesystem and method is implemented at edge servers located in widelydistributed in geographic areas, the requested served by the edgeservers may vary greatly depending on the location. For example, a funnyvideo clip with Japanese language may be more popular among usersserviced by an edge cache in Tokyo, and thus the Tokyo-based edge servermay store that clip. However, the clip may be less popular among usersserviced by an edge cache in London and, accordingly, it will not storethe clip.

A single server may also have multiple tiers of caches and access thosecaches without the aid of a network. For example and as shown in FIG. 4,computer 400 may first check for an item by querying request records 410associated with cache 411. If the item is not in cache 410, it may querya second independent set of request records 420 associated with a secondindependent cache 421. If the second cache does not contain the item,the computer may check other caches associated with other sets ofrequest records.

In that regard, the system and method may be used in connection withdevices having multiple memories of different types. For example, aserver may locally access both a single solid state drive (e.g., a flashdrive) and multiple local disk drives. The flash memory may have lowercapacity than the disk drives, but it may also be able to provide theinformation faster, on average, than the disk drives. Yet further,server may hold less than all of the information that may be requestedfrom it; it may thus access information stored on servers that originatethe information. This information may be stored in the form of chunksthat collectively comprise video files.

FIG. 6 illustrates just one method that may be implemented in a systemthat stores chunks of information in differing tiers of retrieval speedand capacity, e.g., flash memory, disk memory, and memory located atanother node (such as from an origin server). The chunk will beretrieved from the fastest memory storing the chunk, e.g., from theflash memory if it is in the flash memory, from the disk memory if not,and from the origin server if it is stored in neither the flash nor diskmemory. Moreover, whenever the chunk is retrieved from the originserver, a copy may be stored on the local disks (and evict the mostinactive chunk from the local disks if necessary).

However, while a chunk may be automatically stored in the disk memoryafter the chunk is retrieved from the server, it may not beautomatically placed in flash memory after it is retrieved from thedisk. Moreover, a chunk may not be directly promoted from the originserver to the flash memory. Rather, in one aspect of the system andmethod and as shown at reference numerals 610-13, a chunk is onlypromoted from the disk memory to the flash memory when the time elapsedfrom its last request is less than the survival time of the mostrecently evicted chunk in flash memory.

In still another aspect, the system and method of FIG. 6 willautomatically store a chunk in the flash memory if there is room.Alternatively, it may automatically store any chunk received from anorigin server directly into the flash memory (e.g., bypassing the disks)during the time span that begins with the cache being in an empty stateand the cache's first eviction of a chunk.

Rather than relying on the date and time that a client device requestedan item, the cache may also use other time-based events as the basis forcaching decisions. For example, if the item of information is anexecutable file and the system and method is implemented on a personalcomputer, the relevant time of request may be considered the time atwhich the file is loaded from a magnetic disk into a dedicated diskcache (i.e., the request originated in a component of the computer, therequest constituted a demand to load the file into the disk cache, andthe time of the request was when the file began loading). Alternatively,the time of request may be considered the time that the processor beginsexecuting the file after loading it into RAM. Yet further, the time of arequest may be considered the time the request was received, the timethe request was sent, or the time the request was fulfilled.

The system and method may further include various measures to protectthe data. For example, while the request records 145 may be stored asmetadata in RAM for fast access, it records may also be persisted todisk every so often so that if a relevant program crashes or otherwiserestarts, the state may be read from the disk rather than rebuilt.

Most of the foregoing alternative embodiments are not mutuallyexclusive, but may be implemented in various combinations to achieveunique advantages. As these and other variations and combinations of thefeatures discussed above can be utilized without departing from theinvention as defined by the claims, the foregoing description of theembodiments should be taken by way of illustration rather than by way oflimitation of the invention as defined by the claims. It will also beunderstood that the provision of examples of the invention (as well asclauses phrased as “such as,” “including” and the like) should not beinterpreted as limiting the invention to the specific examples; rather,the examples are intended to illustrate only one of many possibleembodiments.

1. A system comprising: a processor configured to retrieve and storeitems in memory in accordance with instructions; a first memory having afirst capacity and a first access time, where access time refers to theaverage time it takes for the processor to obtain information from amemory; a second memory having a second capacity and a second accesstime, the second capacity being greater than the first capacity and thesecond access time being slower than the first access time; a thirdmemory having a third capacity and a third access time, the thirdcapacity being greater than the second capacity and the third accesstime being slower than the second access time; the instructionscomprising, in response to a request for a request for the item receivedby the processor: retrieving the requested item from first memory whenthe requested item is stored in the first memory; retrieving therequested item from second memory when the requested item is stored inthe second memory; retrieving the requested item from third memory whenthe requested item is stored in the third memory; storing the requesteditem in the first memory depending on whether the item was stored in thesecond memory at the time of the request and whether the time elapsedsince the last time the item was requested is less than thelast-eviction duration, where the last-eviction duration comprises theduration of time beginning with the last request for the most-recentlyevicted item while it was still stored in the first memory and endingwith the most-recently evicted item's eviction from the first memory;storing the requested item in the second memory depending on whether theitem was stored in the second memory at the time of the request andwhether the item was retrieved from the third memory.
 2. The system ofclaim 1 wherein the first memory is a flash memory.
 3. The system ofclaim 2 wherein the second memory is a disk memory.
 4. The system ofclaim 2 wherein the processor accesses the third memory via a network.5. The system of claim 1 wherein the items of information comprisechunks of video files.
 6. A system comprising: a processor configured toretrieve and store items in memory in accordance with instructions; afirst memory having a first storage capacity; a second memory having asecond storage capacity greater than the first storage capacity; a thirdmemory having a third storage capacity greater than the second storagecapacity; the instructions comprising, in response to a request for arequest for the item received by the processor: retrieving the requesteditem from first memory when the requested item is stored in the firstmemory; retrieving the requested item from second memory when therequested item is stored in the second memory; retrieving the requesteditem from third memory when the requested item is stored in the thirdmemory; determining a priority value for the requested item and aplurality of items stored in the first memory, the priority value beingbased on a priority function, the priority function being based on theduration of time between requests for items with less weight beingapplied to durations between earlier requests for the item, wherein thepriority function is based on the following function:priority value=−1*(ALPHA*LSn+(1−ALPHA)*En−1); “n” represents the nthoccurrence of the request; “LSn” represents the amount of time thatelapsed between the nth occurrence of the request for and the previousrequest; and “ALPHA” represents a value between and including 0 and 1;and storing the requested item in the first memory when the item hasbeen previously requested, the requested item is stored in the secondmemory, and the priority value of the requested item is greater than thepriority value of at least one other item stored in the first memory.